package org.BooCrack.bookstore.common.utils;

import org.BooCrack.bookstore.common.pojo.BSResult;

public class BSResultUtil {

    private static String SUCCESS="success";

    private static String FAIL="fail";

    public static BSResult success(Object data){
        return new BSResult<>(StatusCode.SUCCESS.code,SUCCESS,data);
    }

    public static BSResult success(){
        return new BSResult<>(StatusCode.SUCCESS.code,SUCCESS,null);
    }

    public static BSResult success(String msg){return new BSResult<>(StatusCode.SUCCESS.code,msg,null);}

    public static BSResult fail(String msg){return new BSResult<>(StatusCode.SERVER_ERROR.code,msg,null);}


    public static BSResult build(Integer code,String message,Object data){
        return new BSResult(code,message,data);
    }

    public static BSResult build(Integer code,String message){
        return new BSResult(code,message,null);
    }




}
